#ifndef __MODULE_H__
#define __MODULE_H__
#include "ModuleSample.h"
#include "ModulePattern.h"
#include "ModuleConstants.h"
#include <iostream>
#include <vector>

namespace modx {
    
    class Module {
        
    public:
        Module(void) {
            moduleSignature = "";
            moduleChannels = 0;
            moduleTitle = "";
            songLength = 0;
        };
        void printSampleInfo(char sampleNumber) {
            if(sampleNumber > 31 || sampleNumber < 0) {
                std::cerr << "Invalid sample number." << std::endl;
            }
            
            ModuleSample& smp = moduleSamples.at(sampleNumber);
            std::cout   << "Sample #" << (int)sampleNumber+1 << std::endl 
                        << "Name: " << smp.sampleName << std::endl
                        << "Length: " << smp.sampleLength << "bytes" << std::endl
                        << "Tune Freq: " << smp.sampleTuneFrequency << "hz" << std::endl
                        << "Volume: " << (int)smp.sampleVolume << std::endl
                        << "Loop Start: " << smp.sampleLoopStart << std::endl
                        << "Loop End: " << smp.sampleLoopLength << std::endl;
        }

        std::string moduleSignature;
        unsigned char moduleChannels;
        std::string moduleTitle;
        std::vector<ModuleSample> moduleSamples;
        unsigned char songLength;
        std::vector<unsigned char> moduleOrders;
		unsigned char moduleNumberPatterns;
		std::vector<ModulePattern> modulePatterns;
    };
}
#endif
